<?php
class Type{
	private $setter;
	private $dbOperator;
	
	private $id;
	private $nombre;
	
	function Type(){
		$this->setter=new Setter("../../Config");
		$this->dbOperator=new DbOperator($this->setter->getDataBaseHost(),$this->setter->getDataBaseUserName(),$this->setter->getDataBaseName(),$this->setter->getDataBasePassword());
		$this->id="";
		$this->nombre="";
	}
	
	function setId($id=""){
		$this->id=$id;
	}
	function getId(){
		return $this->id;
	}
		
	function setNombre($nombre=""){
		$this->nombre=$nombre;
	}
	function getNombre(){
		return $this->nombre;
	}
	
		
	function guardar(){
		$this->dbOperator->connect();
		//Guardar en la tabla roles
		$this->dbOperator->dbInsert(array("",$this->nombre),"tiposInmueble");
	}
	function eliminar(){
		$this->dbOperator->connect();
		$this->dbOperator->erase("tiposInmueble","id",$this->id);			
	}
 	
	function cargar($idType="0"){
		$this->dbOperator->connect();
		$dataType=$this->dbOperator->consult("SELECT * FROM tiposInmueble WHERE id='".$idType."'","yes");
		$this->id=$dataType[0];
		$this->nombre=$dataType[1];
	}
}
?>
